<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>JSON.parse()</title>
</head>
<body>
<script>
    var person = {//js对象
        name: "小明",
        age: 18,
        hobby: ["swimming", "sing", "basketball"],
        date: 2000
    };
    var textjson = JSON.stringify(person, null, 4);//js对象转为json格式
    console.log(textjson);
    //把JSON字符串解析为原生JavaScript对象
    var text = JSON.parse(textjson);//json格式转为js对象
    console.log(text);
</script>
</body>
</html>